package com.erongdu.utils;

import com.alibaba.fastjson.JSONObject;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by syq on 2015/6/11.
 */
public class JsonBuilder {


    private Map<String,Object> map = new HashMap<String, Object>();


    public JsonBuilder addData(String key,Object value){
        map.put(key, value);
        return this;
    }


    public JsonBuilder clearAll(){
        map.clear();
        return this;
    }

    public Map<String,Object> build(){
        return map;
    }

    public String mapToJson(){
        return JSONObject.toJSONString(map);
    }

}

